$OpenBSD: patch-base_utils_py,v 1.18 2016/05/05 08:25:31 ajacoutot Exp $
--- base/utils.py.orig	Wed May  4 07:23:22 2016
+++ base/utils.py	Thu May  5 10:02:31 2016
@@ -138,11 +138,11 @@ for s in EXPECT_WORD_LIST:
 def get_cups_systemgroup_list():
     lis = []
     try:
-        fp=open('/etc/cups/cupsd.conf')
+        fp=open('${SYSCONFDIR}/cups/cupsd.conf')
     except IOError:
         try:
-            if "root" != grp.getgrgid(os.stat('/etc/cups/cupsd.conf').st_gid).gr_name:
-                return [grp.getgrgid(os.stat('/etc/cups/cupsd.conf').st_gid).gr_name]
+            if "root" != grp.getgrgid(os.stat('${SYSCONFDIR}/cups/cupsd.conf').st_gid).gr_name:
+                return [grp.getgrgid(os.stat('${SYSCONFDIR}/cups/cupsd.conf').st_gid).gr_name]
         except OSError:
             return lis
 
@@ -584,7 +584,7 @@ class UserSettings(object): # Note: Deprecated after 2
         if len(path):
             self.cmd_pcard = 'hp-unload -d %DEVICE_URI%'
         else:
-            self.cmd_pcard = 'python %HOME%/unload.py -d %DEVICE_URI%'
+            self.cmd_pcard = '${MODPY_BIN} %HOME%/unload.py -d %DEVICE_URI%'
 
         # Copy
         path = which('hp-makecopies')
@@ -592,7 +592,7 @@ class UserSettings(object): # Note: Deprecated after 2
         if len(path):
             self.cmd_copy = 'hp-makecopies -d %DEVICE_URI%'
         else:
-            self.cmd_copy = 'python %HOME%/makecopies.py -d %DEVICE_URI%'
+            self.cmd_copy = '${MODPY_BIN} %HOME%/makecopies.py -d %DEVICE_URI%'
 
         # Fax
         path = which('hp-sendfax')
@@ -600,7 +600,7 @@ class UserSettings(object): # Note: Deprecated after 2
         if len(path):
             self.cmd_fax = 'hp-sendfax -d %FAX_URI%'
         else:
-            self.cmd_fax = 'python %HOME%/sendfax.py -d %FAX_URI%'
+            self.cmd_fax = '${MODPY_BIN} %HOME%/sendfax.py -d %FAX_URI%'
 
         # Fax Address Book
         path = which('hp-fab')
@@ -608,7 +608,7 @@ class UserSettings(object): # Note: Deprecated after 2
         if len(path):
             self.cmd_fab = 'hp-fab'
         else:
-            self.cmd_fab = 'python %HOME%/fab.py'
+            self.cmd_fab = '${MODPY_BIN} %HOME%/fab.py'
 
     def load(self):
         self.loadDefaults()
@@ -967,10 +967,9 @@ def all(S,f=lambda x:x):
         if not f(x): return False
     return True
 
-BROWSERS = ['firefox', 'mozilla', 'konqueror', 'epiphany', 'skipstone'] # in preferred order
-BROWSER_OPTS = {'firefox': '-new-tab', 'mozilla': '', 'konqueror': '', 'epiphany': '--new-tab', 'skipstone': ''}
+BROWSERS = ['xdg-open']
+BROWSER_OPTS = {'xdg-open' : ''}
 
-
 def find_browser():
     if platform_avail and platform.system() == 'Darwin':
         return "open"
@@ -2036,51 +2035,54 @@ def chunk_write(response, out_fd, chunk_size =8192, st
 def download_from_network(weburl, outputFile = None, useURLLIB=False):
     retValue = -1
 
-    if weburl is "" or weburl is None:
-        log.error("URL is empty")
-        return retValue, ""
+    if platform.system() == "Linux":
+        if weburl is "" or weburl is None:
+            log.error("URL is empty")
+            return retValue, ""
 
-    if outputFile is None:
-        fp, outputFile = make_temp_file()
+        if outputFile is None:
+            fp, outputFile = make_temp_file()
 
-    try:
-        if useURLLIB is False:
-            wget = which("wget")
-            if wget:
-                wget = os.path.join(wget, "wget")
-                status, output = run("%s --cache=off --tries=3 --timeout=60 --output-document=%s %s" %(wget, outputFile, weburl))
-                if status:
-                    log.error("Failed to connect to HPLIP site. Error code = %d" %status)
-                    return retValue, ""
-            else:
-                useURLLIB = True
+        try:
+            if useURLLIB is False:
+                wget = which("wget")
+                if wget:
+                    wget = os.path.join(wget, "wget")
+                    status, output = run("%s --cache=off --tries=3 --timeout=60 --output-document=%s %s" %(wget, outputFile, weburl))
+                    if status:
+                        log.error("Failed to connect to HPLIP site. Error code = %d" %status)
+                        return retValue, ""
+                else:
+                    useURLLIB = True
 
-        if useURLLIB:
+            if useURLLIB:
 		
-            #sys.stdout.write("Download in progress..........")
-            try:
-                response = urllib2_request.urlopen(weburl)    
-                file_fd = open(outputFile, 'wb')
-                chunk_write(response, file_fd)
-                file_fd.close()
-            except urllib2_error.URLError as e:
-                log.error("Failed to open URL: %s" % weburl)
-                return retValue, ""
+                #sys.stdout.write("Download in progress..........")
+                try:
+                    response = urllib2_request.urlopen(weburl)    
+                    file_fd = open(outputFile, 'wb')
+                    chunk_write(response, file_fd)
+                    file_fd.close()
+                except urllib2_error.URLError as e:
+                    log.error("Failed to open URL: %s" % weburl)
+                    return retValue, ""
 
-    except IOError as e:
-        log.error("I/O Error: %s" % e.strerror)
-        return retValue, ""
+        except IOError as e:
+            log.error("I/O Error: %s" % e.strerror)
+            return retValue, ""
 
-    if not os.path.exists(outputFile):
-        log.error("Failed to get hplip version/ %s file not found."%hplip_version_file)
+        if not os.path.exists(outputFile):
+            log.error("Failed to get hplip version/ %s file not found."%hplip_version_file)
+            return retValue, ""
+
+        return 0, outputFile
+    else:
         return retValue, ""
 
-    return 0, outputFile
 
 
 
 
-
 class Sync_Lock:
     def __init__(self, filename):
         self.Lock_filename = filename
@@ -2176,7 +2178,7 @@ def check_user_groups(required_grps_str, avl_grps):
         grps =re.sub(r'\s', '', str(grps))
         exp_grp_list = grps.split(',')
     else:
-        exp_grp_list.append('lp')
+        exp_grp_list.append('_cups')
 
     log.debug("Requied groups list =[%s]"%exp_grp_list)
 
